/**
 * 全局变量
 */


/**
 *获取内容 content
 * @param url
 */

function  getData(url,data,method,type,async) {
    var _token   = $('#_token').val();
    data ? data['_token'] = _token : data = { _token : _token};
    console.log(data);

    $.ajax(
        {
            method:method ? method : 'post',
            url:url,
            async: async ? async:true,
            dataType :type ? type:'text',
            data:data,

            success:function(data) {
                layer.closeAll();
                $('#page-content-wrapper').html(data)
            },

            error:function (err) {
                console.log(err);
                layer.closeAll();
                layer.msg('错误!请重试!',{icon: 5,time:1500})
            }
        })
}

var httpRequest = function  httpRequest(url,data,method,type) {
    var _token   = $('#_token').val();
    data ? data['_token'] = _token : data = { _token : _token};

    var response = ''

    $.ajax(
        {
            method:method ? method : 'post',
            url:url,
            async: false,
            dataType :type ? type:'text',
            data:data,

            success:function(data) {
                response = data;
            },
            error:function (err) {
                console.log(err);
                layer.msg('错误!请重试!',{icon: 5,time:1500})
            }
        })
    return response;
}

